Ext.define('AM.controller.Users',{
	extend:'Ext.app.Controller',
	init:function(){
		this.control({
			'userList button[id=delete]' : {
				click:function(o){
					var grid1 = o.ownerCt.ownerCt;
					var data = grid1.getSelectionModel().getSelection();
					if(data.length == 0){
						Ext.Msg.alert("提示","至少选择一条数据");
					}else{
						var ids = [];
						Ext.Array.each(data,function(model){
							ids.push(model.get('id'));
						});
						//后台操作
						Ext.Ajax.request({
							url:"/ExtDemo/DemoServlet",
							params:{
								ids:ids.join(",")
							},
							method:"POST",
							timeout:2000,
							success:function(response,opts){
								Ext.Array.each(data,function(model){
									grid1.getStore().remove(model);
								});
							}
						});
					}
				}
			}
		});
	},
	views  :['List'],
	stores :['Users'],
	models :['User']
});